//
//  ZClubMemberCell.m
//  WeClubs
//
//  Created by Zed Link on 12/4/2017.
//  Copyright © 2017 Zed. All rights reserved.
//

#import "ZClubMemberCell.h"
#import <UIImageView+WebCache.h>

@interface ZClubMemberCell ()



@end

@implementation ZClubMemberCell

- (void)showPhoneAndMessage:(BOOL)isShow
{
    self.phoneCallBtn.hidden = !isShow;
    self.messageBtn.hidden = !isShow;
}


#pragma mark - Private Method

- (void)updateParticipateContent
{
}

#pragma mark - Control Action

- (IBAction)phoneCallAction:(id)sender
{
}

- (IBAction)messageAction:(UIButton *)sender
{
    if (self.productSelectedCallBack) {
        self.productSelectedCallBack(self,!sender.selected);
    }
        
    
    
}

#pragma mark - Private Method

- (void)zSetupCell
{
    [super zSetupCell];
    [self.contentView setBackgroundColor:NAVBAR_BG_COLOR];
    
    [self.logoImgView zCornerDeal:20];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.separatorInset = UIEdgeInsetsMake(0, 56, 0, 0);
    
    [self.jobBtn setImageEdgeInsets:UIEdgeInsetsMake(0, -16, 0, 0)];
    self.jobBtn.userInteractionEnabled = NO;

    [self showPhoneAndMessage:NO];
}

#pragma mark - Getter & Setter

- (void)setModel:(ZStudentModel *)model
{
    if (model == nil) return;
    _model = model;
    self.nameLabel.text = model.name;
    self.subjectLabel.text = [NSString stringWithFormat:@"%d级-%@",model.graduate_year,model.major];
    [self.logoImgView sd_setImageWithURL:[NSURL URLWithString:model.avatar_url] placeholderImage:defaultIcon];
    [self.jobBtn setTitle:model.department forState:UIControlStateNormal];

    NSString *sexImageName = nil;
    if ([model.gender isEqualToString:@"0"]) {
        sexImageName = @"ic_female";
    }else{
        sexImageName = @"ic_male";
    }
  
    [self.jobBtn setImage:[UIImage imageNamed:sexImageName] forState:UIControlStateNormal];

}

@end
